<?php
/**
 * Created by PhpStorm.
 * User: gesangdianzi
 * Date: 2017/12/31
 * Time: 14:16
 */
$key = "cat_left";
$help_cat = Yii::$app->cache->getOrSet($key,function(){
    return \common\models\HelpCat::find()->asArray()->all();
},86400);

$item_key = "hel_items_index_";
$helps = Yii::$app->cache->getOrSet($item_key,function(){
    return \common\models\Help::find()->select(['id','title','cat_id'])->asArray()->limit(100)->all();
},86400);
?>
<?php if(!empty($help_cat))foreach ($help_cat as $cat):?>
<div class="item">
    <div class="title"><?=$cat['name']?></div>
    <ul>
        <?php if(!empty($helps))foreach ($helps as $help):?>
            <?php if($help['cat_id'] == $cat['id']): ?>
                <li><a href="<?=\common\utils\Com::urlHelp($help['id'])?>"><?=$help['title']?></a> </li>
            <?php endif;?>
        <?php endforeach;?>
    </ul>
</div>
<?php endforeach;?>
